package com.example.speeddating.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Getter;
import lombok.Setter;

/**
 * <p>
 * 
 * </p>
 *
 * @author tina
 * @since 2023-06-28 11:14:33
 */
@Getter
@Setter
public class Message implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /**
     * 发送者
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long from;

    @TableField(exist = false)
    private User fromUser;

    /**
     * 内容
     */
    private String content;

    /**
     * 接收者
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long to;


    @TableField(exist = false)
    private User toUser;

    /**
     * 类别
     */
    private Integer type;

    /**
     * url
     */
    private String url;

    /**
     * 经度
     */
    private double longitude;

    /**
     * 维度
     */
    private double latitude;

    /**
     * 是否已读
     */
    private Boolean isRead;

    @TableField(exist = false)
    private Integer unreadCount;

    /**
     * 发送时间
     */
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
    private Date createTime;
}
